package com.wdh.kjs.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.TextView;

import com.wdh.kjs.R;

/**
 * Created by CQH on 2016/4/21.
 */
public class SelectPicPopupWindow extends Activity implements View.OnClickListener {
    private TextView rate_1;
    private TextView rate_2;
    private TextView rate_3;
    private TextView rate_4;
    private TextView rate_5;
    private String rate_low;
    private String rate_high;
    private Intent intent;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.screen_rate);
        init();
        pass();
    }

    private void pass(){

    }
    private void init(){
        rate_1 = (TextView)findViewById(R.id.rate_1);
        rate_2 = (TextView)findViewById(R.id.rate_2);
        rate_3 = (TextView)findViewById(R.id.rate_3);
        rate_4 = (TextView)findViewById(R.id.rate_4);
        rate_5 = (TextView)findViewById(R.id.rate_5);
        rate_1.setOnClickListener(this);
        rate_2.setOnClickListener(this);
        rate_3.setOnClickListener(this);
        rate_4.setOnClickListener(this);
        rate_5.setOnClickListener(this);
    }

    //实现onTouchEvent触屏函数但点击屏幕时销毁本Activity
    @Override
    public boolean onTouchEvent(MotionEvent event){
        finish();
        return true;
    }

    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.rate_1:
                rate_low = "0.07";
                rate_high = "0.09";
                break;
            case R.id.rate_2:
                rate_low = "0.09";
                rate_high = "0.11";
                break;
            case R.id.rate_3:
                rate_low = "0.11";
                rate_high = "0.13";
                break;
            case R.id.rate_4:
                rate_low = "0.13";
                rate_high = "0.15";
                break;
            case R.id.rate_5:
                rate_low = "0.00";
                rate_high = "0.07";
                break;
            default:
                break;
        }
        intent = new Intent();
        intent.putExtra("benefit_low",rate_low);
        intent.putExtra("benefit_high",rate_high);
        setResult(12,intent);
//        intent.setClass(SelectPicPopupWindow.this,ScreeningActivity.class);
//        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//        startActivity(intent);

        finish();

    }

}